/*
 * Copyright (c) 2017. 恒昌互联网运营中心.
 */
package com.credithc.eagleeye.console.mail;
import org.apache.commons.lang.StringUtils;

import java.util.ResourceBundle;
public class MailConfig {
    private static ResourceBundle resource;
    private static final String PROPERTY_FILE_NAME = "property/mail";
    public static final String MAIL_SMTP_ADDRESS = getConfigValue("mail.smtp.address");
    public static final String MAIL_SENDER_USER = getConfigValue("mail.sender.user");
    public static final String MAIL_SENDER_PASSWORD = getConfigValue("mail.sender.password");
    public static final String MAIL_RECEIVER_DLR = getConfigValue("mail.receiver.dlr");
    public static final String MAIL_RECEIVER_HYD = getConfigValue("mail.receiver.hyd");
    public static final String MAIL_RECEIVER_CSC = getConfigValue("mail.receiver.csc");
    public static final String MAIL_ENV = getConfigValue("mail.env");
    public static final String[] MAIL_ALERT_PLATFORMS = StringUtils.split(getConfigValue("mail.alert.platformNames"),",");
    public static String getConfigValue(String key) {
        if (resource == null) {
            init();
        }
        return resource.getString(key);
    }
    public static void init() {
        resource = ResourceBundle.getBundle(PROPERTY_FILE_NAME);
    }
    static {
        init();
    }
}
